import request from '@/utils/request'

// 查询设备信息列表
export function listDevice(query) {
  return request({
    url: '/producer/device/list',
    method: 'get',
    params: query
  })
}

// 查询设备信息详细
export function getDevice(id) {
  return request({
    url: '/producer/device/' + id,
    method: 'get'
  })
}

// 新增设备信息
export function addDevice(data) {
  return request({
    url: '/producer/device',
    method: 'post',
    data: data
  })
}

// 修改设备信息
export function updateDevice(data) {
  return request({
    url: '/producer/device',
    method: 'put',
    data: data
  })
}

// 删除设备信息
export function delDevice(id) {
  return request({
    url: '/producer/device/' + id,
    method: 'delete'
  })
}


// 查询设备收入趋势
export function incomeTrend(query) {
  return request({
    url: '/producer/earnings/query',
    method: 'get',
    Headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    params: query
  })
}

// 带宽使用趋势
export function bandwidthTrend(query) {
  return request({
    url: '/producer/network/list',
    method: 'get',
    params: query
  })
}
// 在线点数
export function timeCountList(query) {
  return request({
    url: '/producer/network/time/count/list',
    method: 'get',
    params: query
  })
}

// 压测列表
export function stressTestList(query) {
  return request({
    url: '/producer/press/selectOne',
    method: 'get',
    params: query
  })
}

// 硬件信息
export function hardwareInfo(query) {
  return request({
    url: '/producer/hardware/list',
    method: 'get',
    params: query
  })
}

// 修改带宽
export function updateBandwidth(data) {
  return request({
    url: '/producer/device/editHandWidth',
    method: 'put',
    data: data
  })
}

// 发起压测
export function startStressTest(data) {
  return request({
    url: '/producer/press/create/press',
    method: 'put',
    data: data
  })
}

// 查询设备限速
export function getDeviceLimitSpeed(query) {
  return request({
    url: '/producer/speed/bySn',
    method: 'get',
    params: query
  })
}

// 修改设备限速
export function updateDeviceLimitSpeed(data) {
  return request({
    url: '/producer/speed',
    method: 'put',
    data: data
  })
}

// 修改标签
export function updateDeviceTag(data) {
  return request({
    url: '/producer/device/setTag',
    method: 'put',
    data: data
  })
}

// 获取设备信息详细
export function getDeviceDetail(id) {
  return request({
    url: '/producer/device/' + id,
    method: 'get'
  })
}

// 解绑设备
export function unbindDevice(id) {
  return request({
    url: '/producer/device/' + id,
    method: 'delete',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}